package com.cwj.virtualapi.controller;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/validate")
public class ValidationController {

    @CrossOrigin
    @GetMapping
    public Map<String, Object> getValidateStatus(Integer money) {
        Map<String, Object> response = new HashMap<>();
        Integer remainMoney = 5000;
        if (money < remainMoney) {
            response.put("success", true);
        } else {
            response.put("success", false);
            response.put("message", "当前剩余金额：" + remainMoney);
        }
        return response;
    }
}
